<%@page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s" %>
<%String path=request.getContextPath();String basePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";if(session.getAttribute("user")==null){response.sendRedirect(basePath);};%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<base href="<%=basePath%>">
	<title><s:text name="sys.app_title" /></title>
	<%@include file="../include/contentheader.jsp"%>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
	<link rel="stylesheet" type="text/css" href="css/dtree.css"/>
	<link rel="stylesheet" type="text/css" href="css/main.css"/>
	<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
	<script type="text/javascript" src="js/app.js"></script>
	<script type="text/javascript" src="js/dtree.js"></script>
	<script type="text/javascript">
		function doRefresh(){
			location.href="tmplt-list.action?FN=<s:property value='FN' />";
		}
		function doAdd(){
			location.href="tmplt-oprt.action?FN=<s:property value='FN' />&opt=0";
		}
		function doEdit(){
			var j=0;
			var t='';
			$("input[name='templateCode']").each(function(){
				if($(this).attr('checked')){
					j++;
					t = $(this).val();
				}
			});
			if(j==0){alert("请先选择要进行修改的记录.");return false;}
			if(j>1){
				alert("请选择某一条具体的记录再进行此操作.");
				return false;
			}
			if(j==1)location.href="tmplt-oprt.action?FN=<s:property value='FN' />&opt=1&t="+t;
		}
		function doDel(){
			var j=0;
			var tArr = new Array();
			$("input[name='templateCode']").each(function(){
				if($(this).attr('checked')){
					j++;
					tArr.push($(this).val());
				}
			});
			if(j==0){alert("请先选择要进行删除的记录.");return false;}
			$("#t").val(tArr.join());
			if(confirm("确定要删除所选记录吗?删除之后将不能恢复!")){
				$("#HIDDENFORM").submit();
			}
		}
		function setTpltAuthority(){
			var j=0;
			var t='';
			$("input[name='templateCode']").each(function(){
				if($(this).attr('checked')){
					j++;
					t = $(this).val();
				}
			});
			if(j==0){alert("请先选择要进行权限设置的记录.");return false;}
			if(j>1){
				alert("请选择某一条具体的记录再进行此操作.");
				return false;
			}
			if(j==1)location.href="tmplt-role.action?FN=<s:property value='FN' />&opt=2&t="+t;
		}
		function doExport(){
		}
		function doRetrieve(){
			var qryC=$.trim($('#qryCondition').val());
			if(qryC==''){
				alert('请输入查询条件');
				$('#qryCondition').val('').focus();
				return false;
			}
			location.href="tmplt-retrieve.action?FN=<s:property value='FN' />&qry="+encodeURIComponent(qryC);
		}
	</script>
</head> 
<body>

<div class="mainContainer">
	<div class="headerTitle"><s:property value="navStr" /></div>
	<div class="dataDivLeftNoTree">

<table class="gridTable" border="0" cellspacing="0" cellpadding="0">
	<tr class="operatorAction">
		<td>
			<!-- 功能性操作 -->
			<input type="button" style="margin-left:2px;" onclick="doRefresh();" value="刷新" />
			<input type="button" style="margin-left:2px;" onclick="doAdd();" value="新增" />
			<input type="button" style="margin-left:2px;" onclick="doEdit();" value="修改" />
			<input type="button" style="margin-left:2px;" onclick="doDel();" value="删除" />
			<input type="button" style="margin-left:2px;" onclick="setTpltAuthority();" value="设置权限" />
			<input type="button" style="margin-left:2px;" onclick="doExport();" value="导出" />
			<input type="text" id="qryCondition" class="qryTxt" value="" /><input type="button" style="margin-left:1px;" onclick="doRetrieve();" value="查询" />
		</td>
	</tr>
    <tr>
		<td class="gridData">  
		
			<table class="dataTable" border="0" cellpadding="0" cellspacing="1">
	          <tr class="dataHeader">
	          	<!-- 数据表头 -->
	            <td width="1%"><input id="checkAll" type="checkbox" /></td>
	            <td width="2%">序号</td>
	            <td width="20%">模板名称</td>
	            <td width="10%">模板类型</td>
	            <td width="10%">模板状态</td>
	          </tr>
	          
	           <!-- 数据 -->
	            <s:iterator var="t" value="pagination.dataList">
 				<tr class="dataRow">
 					<td><input name="templateCode" type="checkbox" value="<s:property value="#t.templateCode"/>" /></td>
 					<td><s:property value="#t.seq"/></td>
		            <td><s:property value="#t.templateName" escape="false"/></td>
		            <td><s:if test="#t.templateType==\"S\"">系统初始角色</s:if><s:else>用户自定义角色</s:else></td>
		            <td><s:if test="#t.status==\"A\"">在用</s:if><s:else>弃用</s:else></td>
		            <td style="display:none;">
		            <img src="images/037.gif" width="9" height="9" /><span>[</span><a href="tmplt-oprt?FN=<s:property value='FN' />&opt=1&t=<s:property value='#t.templateCode' />" style="cursor: pointer;">编辑</a><span>]</span>
		            </td>
		            <td style="display:none;">
		            <img src="images/037.gif" width="9" height="9" /><span>[</span><a href="findStaff.action?staid=<s:property value='#sta.staid'/>" style="cursor: pointer;">设置权限</a><span>]</span>
		            </td>
		            <td style="display:none;"><span class="STYLE2">
		            <img src="images/010.gif" width="9" height="9" /></span><span>[</span><a href="javascript:if(confirm('确认删除？')){location.href='tmplt-del?FN=<s:property value='FN' />&t=<s:property value='#t.templateCode' />'}">删除</a><span>]</span></td>
 				</tr>
   				</s:iterator>
			</table>
			
		</td>
	</tr>
	<tr class="dataPager">
		<td><s:property value="pageLink" escapeHtml="false" /></td>
	</tr>
</table>

	</div>
</div>
	<form action="tmplt-del.action" method="post" id="HIDDENFORM" name="HIDDENFORM">
		<input type="hidden" id="FN" name="FN" value="<s:property value='FN' />" />
		<input type="hidden" id="t" name="t" value="" />
	</form>
</body>  
</html>